def proto_acc(v=None):
	def acc():
		return v
	return acc

acc0 = proto_acc()
import new

make_acc = lambda cell: (new.function
(acc0.func_code,acc0.func_globals,'#cell_acc',acc0.func_defaults,(cell,)))

def cell_deref(cell):
	return make_acc(cell)()

def cells_by_name(f):
	if f.func_closure is None: return {}
	cells = map(lambda x: cell_deref(x), f.func_closure)
	return dict(zip(f.func_code.co_freevars, cells))

